package com.shanzmoo.db.mall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shanzmoo.db.mall.entity.MallOrderEntity;
import com.shanzmoo.db.mall.entity.MallOrderLogEntity;
import com.shanzmoo.db.mall.mapper.MallOrderMapper;
import com.shanzmoo.db.mall.service.IMallOrderLogService;
import com.shanzmoo.db.mall.service.IMallOrderService;
import com.shanzmoo.db.report.entity.vo.ProductSalesVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商城订单 服务实现类
 * </p>
 *
 * @author Gzhao
 * @since 2021-01-06
 */
@Service
public class MallOrderServiceImpl extends ServiceImpl<MallOrderMapper, MallOrderEntity> implements IMallOrderService {

    @Autowired
    private IMallOrderLogService mallOrderLogService;

    @Override
    public List<ProductSalesVO> getProductSales() {
        return baseMapper.getProductSales();
    }

    @Override
    public void saveOperateLog(Integer orderId, String description, int currentUser) {
        MallOrderLogEntity logEntity = new MallOrderLogEntity();
        logEntity.setOrderId(orderId);
        logEntity.setDescription(description);
        logEntity.setCreateUser(currentUser);

        mallOrderLogService.save(logEntity);
    }
}
